package br.ita.comp.ces22.quiz.email.adapter;

import java.net.URL;
import java.util.Map;
import br.ita.comp.ces22.quiz.email.exception.EmailAdapterException;

/**
 * Adapter for e-mail based communication.
 * <p>This interface defines what an e-mail adapter should do:
 * synchronously send an email to an specific address,
 * with an specific content (and subject)</p>
 * 
 * @author Diego
 */
public interface EmailAdapter {
    
    /**
     * Synchronously send an e-mail with the already configured settings
     * @param toAddress the destination of this message
     * @param content the message content (in HTML format)
     * @param subject the message subject
     * @return The message-id of the e-mail
     * @throws EmailAdapterException Any exception throw during the process of sending the message to the SMTP host
     */
    public String sendEmail(String toAddress, String content, String subject) throws EmailAdapterException;

    /**
     * Synchronously send an e-mail with attachments
     * @param toAddress the destination of this message
     * @param content the message content (in HTML format)
     * @param subject the message subject
     * @param attachments the map from CID(Content-ID) to {@link URL} describing the attachments to use
     * @return The message-id of the e-mail
     * @throws EmailAdapterException Any exception throw during the process of sending the message to the SMTP host
     */
    public String sendEmail(String toAddress, String content, String subject, Map<String, URL> attachments) throws EmailAdapterException;
}
